
import {createApi} from "@reduxjs/toolkit/query/react";
import useBaseQuery from "@/hooks/useBaseQuery";
import { stringify } from "qs";


export const myApi = createApi({
    reducerPath:'myApi',
    baseQuery:useBaseQuery(''),
    endpoints(build) {
      return {
        getPhoneCode: build.mutation({
          query(data) {
            return {
              url:'/login/common/sendVerifiedPhoneSms',
              method:"post",
              body: data,
              openErrMessage: true
            }
          },
        }),
        verifiedUserPhone: build.mutation({
          query(data) {
            return {
              url:'/login/common/verifiedUserPhone',
              method:"post",
              body: data,
              openErrMessage: true
            }
          },
        }),
        getProductUsageCount: build.mutation({
          query(data) {
            return {
              url:'/mm/mmProductUsage/product_usage',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
        getFeeLogList: build.query({
          query(data) {
            return {
              url:'/mm/mmFeeLog/list',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
        getSelectByRealName: build.mutation({
          query(data) {
            return {
              url:'/sys/user/selectByRealName',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
        getPayList: build.query({
          query(data) {
            return {
              url:'/mm/pay/list',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
        getUnreadQuantity: build.mutation({
          query(data) {
            return {
              url:'/sys/annountCement/vue3List/app/queryUnreadQuantity',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        updateLogsRead: build.mutation({
          query(data) {
            return {
              url:'/sys/annountCement/vue3List/updateLogsRead',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
        feedbackAdd: build.mutation({
          query(data) {
            return {
              url:'/common/feedback/add',
              method:"post",
              body: data,
              openErrMessage: true
            }
          },
        }),
        getDeliveryPerson: build.mutation({
          query(data) {
            return {
              url:'/common/deliveryPerson/getDeliveryPerson',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        logout: build.mutation({
          query(data) {
            return {
              url:'/sys/logout',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        updatePassword: build.mutation({
          query(data) {
            return {
              url:'/sys/user/updatePassword',
              method:"put",
              body: data,
              openErrMessage: true
            }
          },
        }),
        reastPassword: build.mutation({
          query(data) {
            return {
              url:'/sys/user/passwordChange',
              method:"get",
              body: data,
              openErrMessage: true
            }
          },
        }),
      }
    }
});

export const {
  useGetPhoneCodeMutation,
  useVerifiedUserPhoneMutation,
  useGetProductUsageCountMutation,
  useGetFeeLogListQuery,
  useGetSelectByRealNameMutation,
  useGetPayListQuery,
  useGetUnreadQuantityMutation,
  useUpdateLogsReadMutation,
  useFeedbackAddMutation,
  useGetDeliveryPersonMutation,
  useLogoutMutation,
  useUpdatePasswordMutation,
  useReastPasswordMutation,
} = myApi;
